/*
规则界面(新的玩法界面)
*/
cc.Class({
    extends: cc.Component,

    properties: {
        parent:{
            default:null,
            type:cc.Node
        },
        isInit:false,
    },

    onLoad: function () {

    },

    onInit:function(){
        this.mainContent = this.node.getChildByName("mainView").getChildByName("view").getChildByName("content");
        this.typeNode1 = this.mainContent.getChildByName("typeNode1");
        this.typeNode2 = this.mainContent.getChildByName("typeNode2");
        this.typeSelect = this.node.getChildByName("typeSelect");
        this.isInit = true;
    },

    selectGameType:function(event, customEventData){
        var index = parseInt(customEventData);
        this.mainContent.y = 0;
        this.typeSelect.getChildByName("toggle1").getComponent("cc.Toggle").isChecked = false;
        this.typeSelect.getChildByName("toggle2").getComponent("cc.Toggle").isChecked = false;
        this.typeNode1.active = false;
        this.typeNode2.active = false;
        if(index == 1)
        {
            this.typeNode1.active = true;
            this.typeSelect.getChildByName("toggle1").getComponent("cc.Toggle").isChecked = true;
        }
        if(index == 2)
        {
            this.typeNode2.active = true;
            this.typeSelect.getChildByName("toggle2").getComponent("cc.Toggle").isChecked = true;
        }
    },

    showLayer:function(type){
        if(this.isInit == false)
            this.onInit();
        if(type)
            this.selectGameType(-1,type);
        this.node.active = true;
    },

    hideLayer:function(){
        this.node.active = false;
    },
});
